/* ==========================================================================
   1. DEĞİŞKENLER (VARIABLES) & TEMEL AYARLAR
   ========================================================================== */
:root {
    --bg-body: #131f24;
    --card-bg: #202f36;
    --color-green: #58cc02;
    --shadow-green: #46a302;
    --color-cyan: #1cb0f6;
    --shadow-cyan: #1899d6;
    --color-red: #ff4b4b;
    --shadow-red: #cc3c3c;
    --text-main: #ffffff;
    --text-muted: #afb6b8;
    --border-radius: 16px;
    
    /* Dark Mode varsayılanları */
    --bg: #141414;
    --bg-dark: #0f0f0f;
}

html { scrollbar-width: none; } /* Firefox */
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Nunito', sans-serif;
    margin: 0; padding: 0;
    user-select: none;
    -ms-overflow-style: none; /* IE/Edge */
}
::-webkit-scrollbar { display: none; } /* Chrome/Safari */

#app-container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: 80px; /* Navbar boşluğu */
}

/* Yardımcı Sınıflar */
.hidden { display: none !important; }
.content-padding { padding-bottom: 70px; }


/* ==========================================================================
   2. EKRAN YÖNETİMİ (SCREEN LOGIC)
   ========================================================================== */
.screen {
    display: none;
    opacity: 0;
    /* Loader bitene kadar görünmesin mantığı */
    visibility: hidden; 
    animation: popIn 0.3s;
}

.screen.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ==========================================================================
   3. HEADER & ÜST BAR
   ========================================================================== */
.game-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-body);
    position: sticky; top: 0; z-index: 50;
    border-bottom: 2px solid #2b3b42;
}

.left-header-group, .header-controls {
    display: flex; align-items: center; gap: 10px;
}

.profile-pic {
    width: 35px; height: 35px; border-radius: 50%;
    background: #ccc; object-fit: cover;
    border: 2px solid var(--color-cyan); cursor: pointer;
}

.header-btn { font-size: 20px; cursor: pointer; }

/* Flag Box (Bayrak Alanı) */
.flag-box {
    display: flex; align-items: center; gap: 6px; /* Güncel gap değeri */
    padding: 5px 10px; border-radius: 15px;
    background: var(--card-bg); border: 2px solid #37464f;
}

.flag-icon-small {
    width: 20px; height: 20px; border-radius: 50%;
    border: 1px solid #ddd; object-fit: cover;
}

.flag-badge {
    position: absolute; top: 15px; left: 15px;
    width: 25px; height: 25px; border-radius: 50%;
    object-fit: cover; border: 2px solid white;
}

/* İstatistik Alanları */
.streak-area {
    background: var(--card-bg); padding: 5px 10px;
    border-radius: 15px; border: 2px solid #ff9600;
    color: #ff9600; font-weight: 900; font-size: 13px;
}

.xp-area {
    background: var(--card-bg); padding: 5px 10px;
    border-radius: 15px; border: 2px solid #00eaff;
    color: #00eaff; font-weight: 900; font-size: 13px;
}

/* Stat XP (Küçük versiyon) */
.stat-xp {
    background: var(--card-bg);
    padding: 3px 7px; /* Güncel padding */
    border-radius: 14px; border: 2px solid #00eaff;
    color: #00eaff; font-weight: 800; font-size: 11px; /* Güncel font */
    display: inline-flex; align-items: center; gap: 3px;
    line-height: 1; width: fit-content;
}

.stat-pill {
    display: flex; align-items: center; gap: 8px;
    font-weight: 800; font-size: 15px;
}


/* ==========================================================================
   4. NAVBAR (ALT MENÜ - FIX VERSİYON)
   ========================================================================== */
/* En son gönderdiğin "NAVBAR FIX" versiyonu */
.bottom-nav {
    position: fixed;
    left: 50%; transform: translateX(-50%);
    bottom: 0;
    width: 100%; max-width: 600px;
    height: 60px;
    background: var(--card-bg);
    border-top: 2px solid #37464f;
    display: flex; justify-content: space-around; align-items: center;
    z-index: 80;
}

.nav-item {
    color: #ffffff; font-size: 26px; /* Fix'teki font boyutu */
    cursor: pointer; opacity: 0.85; transition: 0.2s;
}
.nav-item svg { width: 28px; height: 28px; margin-bottom: 2px; }
.nav-item span { display: none; } /* Yazıları gizle */
.nav-item.active { color: var(--color-cyan); opacity: 1; }


/* ==========================================================================
   5. AUTH (GİRİŞ) EKRANI - REDESIGN VERSİYON
   ========================================================================== */
#screen-auth {
    position: fixed !important; inset: 0;
    width: 100vw; height: 100vh;
    display: flex !important; justify-content: center; align-items: center;
    padding: 30px; box-sizing: border-box;
    z-index: 1000 !important;
    background: var(--bg-body); /* Arkaplan eklendi */
}

.auth-box {
    width: 100%; max-width: 380px;
    background: #1e1e23; /* Redesign rengi */
    padding: 35px 30px;
    border-radius: 20px; text-align: center;
    box-shadow: 0 15px 60px rgba(0,0,0,0.4);
    border: none; /* Redesign'da border kaldırılmıştı veya gölge ile değiştirilmişti */
    animation: authPop 0.4s ease;
}

@keyframes authPop {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.auth-logo { margin-bottom: -15px; } /* Logo ayarı */

.auth-logo img {
    width: 80px; height: 80px; border-radius: 20px;
    object-fit: contain; margin-bottom: 15px;
    filter: drop-shadow(0 0 4px rgba(255,255,255,0.25));
}

.logo { font-size: 58px; font-weight: 800; letter-spacing: -1px; display: inline-flex; align-items: baseline; }
.logo-dot { font-size: 40px; line-height: 0; position: relative; top: 5px; margin-left: 0px; animation: rainbowGlow 3s linear infinite; }
@keyframes rainbowGlow { 0%, 100% { color: #8b5cf6; } 50% { color: #ec4899; } }

.auth-title {
    font-size: 28px; font-weight: 800; margin-bottom: 10px;
    color: #00d0ff;
}

/* Inputlar */
.input-field {
    width: 100%; padding: 14px;
    border-radius: 10px; margin-bottom: 15px;
    border: none; outline: none;
    font-size: 16px; background: #2b2b31;
    color: white; box-sizing: border-box;
    transition: 0.2s;
}
.input-field:focus { background: #323238; border: 1px solid #00c3ff; box-shadow: 0 0 6px rgba(0, 255, 255, 0.35); }


/* ==========================================================================
   6. UI BİLEŞENLERİ (BUTONLAR)
   ========================================================================== */
.big-btn {
    width: 100%; padding: 14px; /* Redesign padding */
    border-radius: 14px; font-size: 17px; font-weight: 800;
    border: none; cursor: pointer; text-transform: uppercase;
    color: white; margin-top: 5px; margin-bottom: 12px;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
    transition: transform 0.1s, box-shadow 0.1s, opacity 0.2s, background-color 0.2s;
}
.big-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.2); }

.btn-green { background: var(--color-green); box-shadow: 0 4px 0 var(--shadow-green); }
.btn-cyan { background: var(--color-cyan); box-shadow: 0 4px 0 var(--shadow-cyan); }
.btn-red { background: var(--color-red); box-shadow: 0 4px 0 var(--shadow-red); }

/* Login Buton Özel Durumları */
.login-btn { position: relative; transition: 0.25s ease; font-weight: 700; letter-spacing: 0.5px; }
.login-btn:active { transform: scale(0.95); }
.login-btn.loading { pointer-events: none; background: #00a8ff !important; box-shadow: 0 4px 0 #007bb3 !important; opacity: 0.9; }
.login-btn.success { background: #22c55e !important; box-shadow: 0 4px 0 #15803d !important; }
.login-btn.error { background: #ef4444 !important; box-shadow: 0 4px 0 #b91c1c !important; }

/* Outline Butonlar */
.btn-outline {
    background: transparent !important; border: 2px solid #3a3a40 !important;
    color: #cfcfcf !important; box-shadow: none !important; margin-bottom: 0 !important;
}
.btn-outline:hover { background: #33333a !important; }
.btn-outline:active { transform: none; box-shadow: none; }

/* Beyaz Outline Buton */
.big-btn.btn-outline-white {
    background: transparent; border: 2px solid rgba(255,255,255,0.85);
    color: #fff; box-shadow: none; padding: 14px 0;
    border-radius: 14px; font-weight: 700; transition: 0.15s;
}
.big-btn.btn-outline-white:hover { background: rgba(255,255,255,0.12); }
.big-btn.btn-outline-white:active { background: rgba(255,255,255,0.25); }

/* Spinner */
.login-spinner {
    width: 18px; height: 18px; border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white; border-radius: 50%;
    animation: spin 0.75s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }


/* ==========================================================================
   7. ANA SAYFA & ÜNİTELER
   ========================================================================== */
.hero-banner {
    background: var(--card-bg); border-radius: 20px;
    padding: 30px 20px; text-align: center;
    border: 2px solid #2b3b42; margin: 20px 20px 30px;
    box-shadow: 0 8px 0 #111;
}
.hero-title { font-size: 28px; font-weight: 900; margin-bottom: 5px; }

.overall-progress {
    width: 90%; max-width: 300px; height: 12px;
    background: #37464f; border-radius: 6px; overflow: hidden; margin: 15px auto 5px;
}
.overall-progress-fill {
    height: 100%; width: 0%; background: var(--color-green);
    border-radius: 6px; transition: width 0.5s;
}
.progress-label { color: var(--text-muted); font-size: 13px; margin-top: 5px; font-weight: 600; }

.section-label { font-size: 19px; font-weight: 900; margin: 0 20px 15px 20px; }

/* Grid & Kartlar */
.quiz-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 16px; padding: 0 20px 20px;
}
.duo-card {
    background: var(--card-bg); border-radius: 16px;
    padding: 20px; position: relative; cursor: pointer;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
    display: flex; flex-direction: column; align-items: center; text-align: center;
}
.card-icon-circle {
    background: rgba(255,255,255,0.25); width: 50px; height: 50px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 24px; margin-bottom: 12px;
}
.test-count {
    font-size: 11px; font-weight: 900; background: rgba(0,0,0,0.3);
    padding: 3px 6px; border-radius: 8px; margin-top: 5px;
}

/* Tema Renkleri */
.theme-0 { background: var(--color-green); box-shadow: 0 4px 0 var(--shadow-green); color: white; }
.theme-1 { background: var(--color-cyan); box-shadow: 0 4px 0 var(--shadow-cyan); color: white; }
.theme-2 { background: #ce82ff; box-shadow: 0 4px 0 #a568cc; color: white; }
.theme-3 { background: #ff9600; box-shadow: 0 4px 0 #cc7800; color: white; }


/* ==========================================================================
   8. TEST LİSTESİ & QUIZ EKRANI
   ========================================================================== */
.test-list-container { padding: 0 20px 20px; }

.test-row {
    background: var(--card-bg); border: 2px solid #37464f;
    border-radius: 16px; padding: 15px 20px; margin-bottom: 10px;
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; transition: 0.2s;
}
.test-row h3 { margin: 0; font-size: 16px; font-weight: 800; }
.test-row span { font-size: 12px; color: var(--text-muted); font-weight: 600; }

.start-badge {
    background: var(--color-green); color: white; padding: 8px 12px;
    border-radius: 12px; font-size: 12px; font-weight: 900;
    box-shadow: 0 3px 0 var(--shadow-green);
}
.completed-badge {
    background: var(--color-cyan); color: white; padding: 8px 12px;
    border-radius: 12px; font-size: 12px; font-weight: 900;
    box-shadow: 0 3px 0 var(--shadow-cyan);
}

/* Quiz Ekranı */
#screen-quiz { display: flex; flex-direction: column; min-height: 100vh; }
.quiz-header { padding: 20px; display: flex; align-items: center; gap: 12px; border-bottom: none; }
.quiz-close-btn { font-size: 24px; cursor: pointer; color: var(--text-muted); }
.quiz-header-center { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.quiz-step-info { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); font-weight: 700; }

.progress-bar-bg {
    flex-grow: 1; height: 12px; background: #37464f;
    border-radius: 6px; overflow: hidden; border: 1px solid #37464f;
}
.progress-fill {
    height: 100%; width: 0%; background: var(--color-green);
    border-radius: 6px; transition: width 0.3s ease-in-out;
}


.quiz-content-wrapper { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    justify-content: flex-start; 
    
    /* --- YENİ EKLENTİ: Sabit butona yer açma --- */
    padding-bottom: 80px; 
    /* --------------------------------------------- */
}

.question-text-area { 
    padding: 20px; 
    text-align: left; 
    max-width: 500px; 
    
    /* YENİ VE DETAYLI MARJİN AYARI */
    margin-top: -5px;      /* Soru Metnini yukarı kaydır */
    margin-right: auto;    /* Yatayda ortala */
    margin-left: auto;     /* Yatayda ortala */
    
    /* Şıklarla arasına 25 piksel boşluk koy */
    margin-bottom: 2px;   /* ⬅️ Bu değeri ayarlayarak alt boşluğu kontrol edebilirsiniz */
}
.question-text-area h1 { 
    font-size: 24px; 
    font-weight: 900; 
    line-height: 1.4; 
    margin: 0; 
    color: var(--text-main); 
}

.options-container { padding: 0 20px; display: flex; flex-direction: column; gap: 8px; }
/* --- GÜNCELLENMİŞ: KOMPAKT ŞIK KARTLARI (.opt-btn) --- */
.opt-btn {
    background: var(--card-bg); 
    
    /* GÖLGE VE ÇİZGİ KORUMASI */
    border: 2px solid #37464f;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Yumuşak bir gölge */
    
    /* KOMPAKT YAPMA: Padding küçültülüyor */
    padding: 12px 14px; /* ⬅️ 18px'ten 12px'e düşürüldü (Daha az dikey yer kaplar) */
    
    border-radius: 16px; 
    color: white;
    
    /* Font boyutu aynı kalsın ki okunurluk bozulmasın */
    font-size: 18px; 
    font-weight: 700; 
    cursor: pointer; 
    text-align: left;

    transition: all 0.2s ease;
}
/* Hover, Selected, Correct, Wrong stilleri aynı kalsın */

/* Light Mode için (Kompakt padding'i koruyoruz) */
body.light-mode .opt-btn { 
    background: #ffffff !important; 
    color: #111 !important; 
    border-color: #d0d0d0 !important;
    padding: 12px 14px !important; /* ⬅️ Light Mode padding'i de küçültüyoruz */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important;
}
.opt-btn.selected { background: #ddf4ff; border-color: var(--color-cyan); color: #1899d6; font-weight: 800; }
.opt-btn.correct { background: #d7ffb8; border-color: var(--color-green); color: #58cc02; }
.opt-btn.wrong { background: #ffdfe0; border-color: var(--color-red); color: #ea2b2b; }

.open-answer-input {
    width: 100%; max-width: 600px; margin: 0 auto; display: block;
    background: var(--card-bg); border: 2px solid #37464f;
    border-radius: 16px; padding: 16px 18px;
    font-size: 18px; font-weight: 700; color: white; box-sizing: border-box; outline: none;
    transition: border-color 0.15s ease;
}
.open-answer-input:focus { border-color: var(--color-cyan); }
#open-feedback-box { max-width: 600px; margin: 10px auto 0 auto; display: block; }


/* --- GÜNCELLENMİŞ: KONTROL ET BUTONU SABİTLEME (FIXED) --- */
/* --- GÜNCEL KONTROL ALANI (KİBAR VE SABİT) --- */
.check-area {
    /* Sabitleme ve Konumlandırma */
    position: fixed;               
    bottom: 0;                     
    left: 50%;                     
    transform: translateX(-50%);   
    
    width: 100%;                   
    max-width: 600px;              
    z-index: 70;                   
    
    /* YENİ: Tek butonu ortalamak için sadece text-align kullanıyoruz */
    display: block;                /* Flex yapısını kaldırdık */
    text-align: center;            /* Butonu yatayda ortala */
    
    /* Görünüm */
    background: var(--bg-body);    
    border-top: none !important; 
    box-shadow: 0 -8px 20px rgba(0,0,0,0.7); 
    padding: 10px 20px 20px 20px;  /* Alt boşluk navigasyona göre ayarlı */
    box-sizing: border-box;        
    transition: background 0.2s;   
}

/* Light Mode (Açık Tema) için Arka Planı Güncelle */
body.light-mode .check-area {
    background: #ffffff !important; 
    box-shadow: 0 -8px 20px rgba(0,0,0,0.15) !important; 
}

/* KONTROL ET butonunun marjinini sıfırlayalım ki tam ortada dursun */
.check-area #check-btn {
    margin: 0 auto 0 auto !important;
}



/* ==========================================================================
   ⭐ 9. AI & NEON BUTONLAR (ULTRA NEON KORUNDU)
   ========================================================================== */
.ai-explain-wrapper {
    /* AI butonu için ayrılmış alan (içerikle birlikte kayacak) */
    width: 100%; 
    display: flex; 
    justify-content: center;
    margin-top: 20px; 
    margin-bottom: 30px; /* Sabit butondan önce boşluk bırakmak için artırıldı */
}

/* AI Butonu için boyutlandırma (DAHA KÜÇÜK VERSİYON) */
.ai-explain-btn {
    /* Bu butonun flex yapısında ne kadar yer kaplayacağını belirleriz */
    width: 120px;       /* ⬅️ Genişlik 150px'ten 120px'e düşürüldü */
    flex-shrink: 0;
    
    position: relative;
    padding: 8px 8px;   /* ⬅️ Padding 10px'ten 8px'e düşürüldü (İç boşluk azaldı) */
    border: none;
    
    /* Yarıçapı (radius) küçültelim ki daha kompakt dursun */
    border-radius: 30px; /* ⬅️ 40px'ten 30px'e düşürüldü */
    
    font-size: 13px;    /* ⬅️ Yazı boyutu 15px'ten 13px'e düşürüldü */
    font-weight: 800;
    color: white;
    background: #0f0f0f;
    cursor: pointer;
    transition: 0.25s ease;
    overflow: hidden;
    filter: brightness(1.25);
    
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}
/* Kontrol Butonuna esneklik verip kalan alanı doldurmasını sağla */
.check-area #check-btn {
    flex: 1; /* Kalan alanı doldur */
    margin-bottom: 0 !important;
}

/* AI Butonu Pasifken Kaybolmasın (GÖRÜNÜRLÜK FIX'i) */
.ai-explain-btn:disabled { 
    cursor: not-allowed; 
    /* YENİ: Grayscale'i azaltıyoruz, parlaklığı artırıyoruz */
    filter: grayscale(50%) brightness(0.8) !important; 
    
    /* Opacity'i koruyoruz ki tamamen kaybolmasın */
    opacity: 0.8 !important; 
    pointer-events: none;
    
    /* Neon animasyonunu pasifken durdurmak estetik olur */
    animation: none !important;
}

/* ULTRA NEON HALO */
.ai-explain-btn::before {
    content: ""; position: absolute; top: -90%; left: -90%; width: 280%; height: 280%;
    background: conic-gradient(#ff00c8, #a327ff, #4f6bff, #00d4ff, #00ffcc, #ffee00, #ff0059, #ff00c8);
    opacity: 0.75; border-radius: 50%; z-index: -1;
    animation: neonSpin 2.1s linear infinite, neonPulse 2.2s ease-in-out infinite;
}
@keyframes neonSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes neonPulse { 0% { opacity: 0.45; transform: scale(1); } 50% { opacity: 0.95; transform: scale(1.12); } 100% { opacity: 0.45; transform: scale(1); } }

.ai-explain-btn::after {
    content: ""; position: absolute; inset: 4px;
    background: #161616; border-radius: inherit; z-index: -1;
}
.ai-explain-btn:enabled { box-shadow: 0 0 30px rgba(190, 90, 255, 0.85); }
.ai-explain-btn:enabled:hover {
    transform: scale(1.07);
    box-shadow: 0 0 40px rgba(200, 120, 255, 1), 0 0 65px rgba(150, 70, 255, 0.9);
}
.ai-explain-btn:disabled { cursor: not-allowed; filter: grayscale(55%) brightness(0.6); }

/* AI Modal */
.ai-modal {
    position: fixed; left: 0; right: 0; bottom: 22px;
    display: flex; justify-content: center; width: 100%;
    pointer-events: none; z-index: 9999;
}
.ai-modal-content {
    width: 90%; max-width: 450px; background: #111318;
    border-radius: 14px; padding: 16px; border: 1px solid #2b2b2b;
    color: white; pointer-events: auto; box-shadow: 0 12px 28px rgba(0,0,0,0.55);
    animation: aiSlideUp 0.25s ease-out;
}
@keyframes aiSlideUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }

.ai-modal-header { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 12px; }
.ai-close-btn { background: none; border: none; color: #bbb; font-size: 20px; cursor: pointer; }
.ai-close-btn:hover { color: #ff4b4b; }
.ai-explain-text { font-size: 14px; color: #ddd; white-space: pre-line; max-height: 220px; overflow-y: auto; }

/* AI Mini Button */
.ai-mini-wrapper { display: flex; justify-content: center; margin-top: 20px; margin-bottom: 6px; }
.ai-mini-btn {
    position: relative; padding: 7px 14px; border: none; border-radius: 24px;
    font-size: 11px; font-weight: 700; color: white; background: #0f0f0f;
    cursor: default; transition: 0.25s ease; overflow: hidden; opacity: 1; filter: brightness(1.2);
}
.ai-mini-btn::before {
    content: ""; position: absolute; top: -95%; left: -95%; width: 260%; height: 260%;
    background: conic-gradient(#ff00c8, #a327ff, #4f6bff, #00d4ff, #00ffcc, #ffee00, #ff0059, #ff00c8);
    opacity: 0.65; border-radius: 50%; z-index: -1;
    animation: miniSpin 2.1s linear infinite, miniPulse 2.2s ease-in-out infinite;
}
@keyframes miniSpin {
    0% { transform: rotate(0deg); } 30% { transform: rotate(160deg); } 60% { transform: rotate(220deg); } 100% { transform: rotate(360deg); }
}
.ai-mini-btn::after {
    content: ""; position: absolute; inset: 2px; background: #161616; border-radius: inherit; z-index: -1;
}


/* ==========================================================================
   10. MODALLAR (LOADING & PREMIUM)
   ========================================================================== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.65);
    display: flex; justify-content: center; align-items: center; z-index: 99999;
}
/* Blur efekti */
body:not(.light-mode) .modal-overlay { backdrop-filter: blur(2px); }

.modal-content {
    background: var(--card-bg); padding: 30px; border-radius: 20px;
    text-align: center; width: 80%; max-width: 400px; border: 2px solid var(--color-cyan);
}
.result-stats { display: flex; justify-content: space-around; gap: 20px; margin: 20px 0 10px; }
.stat-item { text-align: center; } .stat-value { font-size: 22px; font-weight: 900; }

/* Premium Modal */
.pro-modal {
    background: var(--card-bg); padding: 28px; border-radius: 18px;
    width: 85%; max-width: 420px; text-align: center;
    border: 1px solid rgba(0,255,200,0.18); box-shadow: 0 12px 28px rgba(0,0,0,0.45);
}
.pro-features {
    margin-top: 15px; text-align: left; background: rgba(255,255,255,0.05);
    padding: 15px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1);
    font-size: 14px; color: #dfe6ee;
}
.pro-features div { margin-bottom: 8px; display: flex; align-items: center; }
.pro-features div::before { content: "✔"; font-weight: 900; color: #00ffcc; margin-right: 8px; }

/* Loaders */
#app-loader {
    position: fixed !important; inset: 0; width: 100vw; height: 100vh;
    background: rgba(10,10,10,0.6); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 999999 !important; opacity: 1; transition: opacity 0.3s ease;
}
#app-loader.hidden { opacity: 0; pointer-events: none; }

.loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(20, 25, 40, 0.88) 0%, rgba(10, 14, 27, 0.95) 40%, rgba(5, 6, 20, 0.98) 100%);
    backdrop-filter: blur(10px); box-shadow: inset 0 0 120px rgba(0, 255, 120, 0.12);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 99999; opacity: 0; pointer-events: none; transition: opacity .35s ease;
}
.loading-overlay.active { opacity: 1; pointer-events: all; }

.loading-gif {
    width: 90px; height: auto; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4));
    animation: pulse 1.4s infinite ease-in-out;
}
.loader-text {
    margin-top: 20px; font-size: 18px; letter-spacing: 0.5px;
    color: #c2faff; animation: loader-blink 1.2s ease-in-out infinite;
}
@keyframes pulse { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.1); opacity: 0.85; } 100% { transform: scale(1); opacity: 1; } }
@keyframes loader-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Diğer Sayfalar */
.leader-header { text-align: center; margin-bottom: 25px; }
.leader-title { font-size: 24px; font-weight: 800; color: var(--color-cyan); }
.leader-subtitle { font-size: 18px; font-weight: 800; color: var(--text-main); }
.leader-item {
    background: var(--card-bg); padding: 12px 15px; border-radius: 14px;
    margin-bottom: 12px; display: flex; align-items: center; gap: 14px; border: 1px solid #2a3338;
}
.leader-avatar { width: 42px; height: 42px; border-radius: 50%; border: 2px solid #333; }
.leader-info { flex: 1; }
.leader-name { font-weight: 700; font-size: 16px; }
.leader-xp { color: #58cc02; font-weight: 800; font-size: 14px; }
.medal { font-size: 26px; width: 38px; text-align: center; }
.gold { color: #ffd700; } .silver { color: #c0c0c0; } .bronze { color: #cd7f32; }
.rank-number { font-size: 20px; font-weight: 800; width: 38px; text-align: center; color: #6d7a84; }

.contribute-container { padding: 15px; }
.contribute-header { text-align: center; margin-bottom: 20px; }
.contribute-header h2 { font-size: 22px; font-weight: 900; color: var(--color-cyan); margin-bottom: 6px; }
.contribute-header p { color: var(--text-muted); font-size: 14px; line-height: 1.4; }
.contribute-card {
    background: #111b20; padding: 20px; border-radius: 14px;
    box-shadow: 0 4px 0 #0a1216; border: 1.5px solid #233036;
    display: flex; flex-direction: column; gap: 14px;
}
.contribute-card label { font-weight: 700; font-size: 14px; margin-top: 5px; }
.textarea { height: 80px; resize: none; padding-top: 12px; }
.profile-card { background: var(--card-bg); padding: 15px; border-radius: 12px; margin-bottom: 20px; border: 1px solid #37464f; }
.settings-area .big-btn { height: 52px !important; display: flex !important; align-items: center !important; justify-content: center !important; }
.theme-btn { flex: 1; padding: 14px 0 !important; font-size: 16px; border-radius: 12px; font-weight: 700; text-align: center; }


/* ==========================================================================
   11. LIGHT MODE (AÇIK TEMA) - TÜM OVERRIDE'LAR BURADA
   ========================================================================== */
body.light-mode { background: #f7f8fa !important; color: #111 !important; }

/* Beyaz Arka Plan & Siyah Yazı Dönüşümleri */
body.light-mode .game-header,
body.light-mode .hero-banner,
body.light-mode .leader-item,
body.light-mode .contribute-card,
body.light-mode .settings-area,
body.light-mode .profile-card,
body.light-mode .flag-box,
body.light-mode .bottom-nav,
body.light-mode .test-list-container,
body.light-mode .test-row,
body.light-mode .duo-card,
body.light-mode #screen-quiz,
body.light-mode .question-text-area,
body.light-mode .options-container,
body.light-mode .ai-modal-content,
body.light-mode .modal-content,
body.light-mode .pro-modal {
    background: #ffffff !important;
    color: #111 !important;
    border-color: #ddd !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08) !important;
}

/* Gradient Banner Fix */
body.light-mode .hero-banner { background: linear-gradient(135deg, #fff, #f2f4f6) !important; }

/* Inline Stil Temizliği (HTML içinde style="..." varsa onları ezer) */
body.light-mode [style*="background:#14181d"], body.light-mode [style*="background: #14181d"],
body.light-mode [style*="background:#0f0f10"], body.light-mode [style*="background: #0f0f10"] {
    background: #ffffff !important; color: #111 !important; border-color: #ddd !important;
}

/* Tüm çocuk elementlerin yazı rengini zorla siyah yap */
body.light-mode .game-header *, body.light-mode .hero-banner *, body.light-mode .leader-item *,
body.light-mode .contribute-card *, body.light-mode .settings-area *, body.light-mode .flag-box *,
body.light-mode .bottom-nav *, body.light-mode .test-list-container *, body.light-mode .test-row *,
body.light-mode #screen-quiz *, body.light-mode .ai-modal-content *, body.light-mode .streak-area * {
    color: #111 !important;
}

/* Streak Area Özel */
body.light-mode .streak-area {
    background: #ffffff !important; color: #ff9600 !important; border: 2px solid #ff9600 !important;
}

/* XP Area Özel */
body.light-mode .xp-area {
    background: #ffffff !important; border: 2px solid #009ac2 !important; color: #009ac2 !important;
}

/* Inputlar */
body.light-mode input, body.light-mode textarea, body.light-mode select {
    background: #ffffff !important; color: #111 !important; border: 1px solid #ccc !important;
}

/* Quiz Seçenekleri */
body.light-mode .opt-btn { background: #ffffff !important; color: #111 !important; border-color: #d0d0d0 !important; }
body.light-mode .opt-btn:hover { border-color: #3b82f6 !important; }
body.light-mode .opt-btn.selected { background: #e6f2ff !important; border-color: #3b82f6 !important; }
body.light-mode .opt-btn.correct { background: #d1f7c4 !important; border-color: #4ade80 !important; }
body.light-mode .opt-btn.wrong { background: #ffd6d6 !important; border-color: #f87171 !important; }

/* Badges */
body.light-mode .completed-badge { background: #d1f7c4 !important; color: #1a5600 !important; }
body.light-mode .test-row .completed-badge { background: #d1f7c4 !important; color: #145c0b !important; }

/* Progress Bar */
body.light-mode .progress-bar-bg { background: #e5e7eb !important; }
body.light-mode .progress-fill { background: var(--color-cyan) !important; }

/* AI Modal Blur */
body.light-mode .ai-explain-wrapper, body.light-mode .ai-modal {
    background: rgba(255, 255, 255, 0.75) !important; backdrop-filter: blur(6px);
}
body.light-mode #ai-explain-text { background: #fafafa !important; color: #111 !important; border: 1px solid #ddd !important; }

/* AI Button Text (Beyaz kalmalı) */
body.light-mode #ai-explain-btn, body.light-mode #ai-explain-btn * { color: #ffffff !important; }

/* White Outline Button */
body.light-mode .big-btn.btn-outline-white { border-color: #222 !important; color: #222 !important; }
body.light-mode .big-btn.btn-outline-white:hover { background: rgba(0,0,0,0.06) !important; }

/* Premium Modal Light */
body.light-mode .pro-modal { background: #ffffff !important; color: #222 !important; border: 1px solid #d0d0d0 !important; }
body.light-mode .pro-features { background: #f4f4f4 !important; border: 1px solid #dddddd !important; color: #333 !important; }
body.light-mode .pro-features div::before { color: #009f8c !important; }
body.light-mode .modal-overlay { backdrop-filter: blur(3px); }

/* ========================================================
   LIGHT MODE DÜZELTMESİ (DUO CARD YAZILARI)
   Bunu dosyanın EN ALTINA yapıştır.
   ======================================================== */

/* Kartın içindeki tüm div'lerin rengini zorla siyah yap */
body.light-mode .duo-card > div {
    color: #111 !important;
}

/* İkonun arka planını ve rengini düzelt */
body.light-mode .card-icon-circle {
    background: rgba(0,0,0,0.06) !important;
    color: #111 !important;
}

/* Test sayısının (örn: 0/5) arka planını ve rengini düzelt */
body.light-mode .test-count {
    background: rgba(0,0,0,0.06) !important;
    color: #555 !important;
}

/* ========================================================
   SON DÜZELTMELER: LIGHT MODE (LOADER & LOGIN & AUTH)
   Bunu main.css dosyasının EN ALTINA yapıştır.
   ======================================================== */

/* 1. APP LOADER & TEST LOADER - BEYAZ TEMA */
body.light-mode #app-loader,
body.light-mode .loading-overlay {
    background: rgba(255, 255, 255, 0.98) !important; /* Tamamen beyaz arka plan */
    backdrop-filter: blur(5px);
}

/* Loader içindeki yazıların rengi */
body.light-mode .loader-text,
body.light-mode .loading-text {
    color: #333333 !important; /* Koyu gri yazı */
    text-shadow: none !important;
}

/* Loader hizalama düzeltmesi (Kaymayı önler) */
.loader-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}
.loader-gif {
    display: block !important;
    margin: 0 auto -10px auto !important; /* Ortala ve alttan boşluk bırak */
}


/* 2. LOGIN (AUTH) EKRANI - BEYAZ TEMA */
body.light-mode #screen-auth {
    background: #f0f2f5 !important; /* Ekranın geneli açık gri */
}

body.light-mode .auth-box {
    background: #ffffff !important; /* Giriş kutusu tamamen beyaz */
    border: 1px solid #e1e4e8 !important; /* İnce gri çerçeve */
    box-shadow: 0 10px 40px rgba(0,0,0,0.08) !important; /* Hafif gölge */
}

/* Login Ekranındaki Başlıklar */
body.light-mode .auth-title {
    color: #1cb0f6 !important; /* Başlık mavi kalsın */
}

/* Login Input Alanları */
body.light-mode .input-field {
    background: #ffffff !important;
    border: 2px solid #e5e5e5 !important;
    color: #111111 !important;
}
body.light-mode .input-field:focus {
    border-color: #1cb0f6 !important;
    background: #ffffff !important;
}

/* Login Butonları */
body.light-mode .btn-outline {
    border-color: #ccc !important;
    color: #555 !important;
}
body.light-mode .btn-outline:hover {
    background: #f0f0f0 !important;
}

/* ========================================================
   ANA LOADER (APP-LOADER) LOGO BOYUTU FIX
   Bunu dosyanın en altına ekle.
   ======================================================== */

#app-loader .loader-gif {
    width: 90px !important;       /* Genişliği sabitler (İstersen 80px yapabilirsin) */
    height: auto !important;      /* Orantıyı korur */
    max-width: 90px !important;   /* Asla bu boyutu geçemesin */
    margin-bottom: -10px !important; /* Yazı ile arasını ayarlar */
    display: block !important;
}

/* Logonun ve yazının tam ortada durmasını garantiye alalım */
#app-loader .loader-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
}

/* ========================================================
   AÇIK UÇLU SORU GERİ BİLDİRİM KUTUSU FIX (LIGHT MODE)
   Bunu main.css dosyasının EN ALTINA yapıştır.
   ======================================================== */

body.light-mode #open-feedback-box {
    background: #ffffff !important;       /* Koyu gri yerine beyaz arka plan */
    border: 1px solid #e5e5e5 !important; /* Koyu çerçeve yerine ince gri */
    color: #111 !important;               /* Genel yazı rengi siyah */
    box-shadow: 0 4px 15px rgba(0,0,0,0.05) !important; /* Hafif modern gölge */
}

/* Kutucuk içindeki "Doğru cevap:" yazısının rengini de garantiye alalım */
body.light-mode #open-feedback-box span,
body.light-mode #open-feedback-box b {
    /* Renkleri (Kırmızı/Yeşil) koruyoruz ama okunabilirliği artırıyoruz */
    font-weight: 800 !important; 
}

/* ========================================================
   SETTINGS KARTLARI (ORİJİNAL TASARIM RESTORE)
   Bunu dosyanın EN ALTINA yapıştır.
   ======================================================== */

.profile-card {
    /* Orijinal inline stildeki değerler */
    background: #14181d !important;
    padding: 18px !important;
    border-radius: 14px !important;
    margin-bottom: 25px !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.22) !important;
    border: none !important; /* Önceki CSS'ten gelen border'ı iptal et */
}

/* Light Mode için özel ayar (Yoksa beyazda kaybolur) */
body.light-mode .profile-card {
    background: #ffffff !important;
    border: 1px solid #ddd !important; /* Beyaz modda sınır çizgisi daha şık durur */
    box-shadow: 0 4px 14px rgba(0,0,0,0.08) !important;
}

/* Ayarlar sayfasının genel boşluğunu garantiye alalım */
.settings-area {
    padding: 20px !important;
}

/* ========================================================
   LİDERLİK ALT BAŞLIĞI (LIGHT MODE FIX)
   Bunu dosyanın EN ALTINA yapıştır.
   ======================================================== */

body.light-mode .leader-subtitle {
    color: #333333 !important; /* Beyaz yerine koyu gri */
}

/* Badge Styles for Settings */
#settings-username span {
    display: inline-block;
    margin-left: 8px;
    font-weight: 800;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* ========================
   DUYURU BANDI (NOTIFICATION) - FİNAL DÜZELTME
   ======================== */
.notification-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; /* Dropdown buna göre hizalanır */
}

.notif-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    pointer-events: none;
}

/* --- KUTU TASARIMI (VARSAYILAN KOYU MOD) --- */
.notif-dropdown {
    display: none; /* JS ile açılacak */
    position: absolute;
    top: 110%; /* Butonun altı */
    right: -10px; /* Hafif sağa yaslı */
    width: 280px;
    background-color: #202f36; /* Koyu Zemin */
    border: 2px solid #37464f;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    z-index: 1000;
    overflow: hidden;
}

.notif-header {
    background-color: #2b3b45;
    padding: 10px;
    font-weight: 800;
    font-size: 13px;
    color: #ffffff;
    border-bottom: 1px solid #37464f;
}

.notif-content {
    padding: 15px;
    font-size: 14px;
    color: #d1d5db;
    max-height: 300px;
    overflow-y: auto;
}

.no-notif { color: #9ca3af; }

/* Renkli Duyuru Kutusu (Koyu Mod) */
.active-announcement {
    font-weight: 600;
    padding: 10px;
    border-radius: 6px;
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
    border-left: 4px solid;
}
.active-announcement.info { border-color: #3b82f6; }
.active-announcement.success { border-color: #10b981; }
.active-announcement.warning { border-color: #f59e0b; }
.active-announcement.danger { border-color: #ef4444; }


/* --- KUTU TASARIMI (AÇIK MOD / LIGHT MODE OVERRIDE) --- */
body.light-mode .notif-dropdown {
    background-color: #ffffff !important;
    border-color: #e5e5e5 !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
}

body.light-mode .notif-header {
    background-color: #f3f4f6 !important;
    color: #1f2937 !important;
    border-bottom: 1px solid #e5e5e5 !important;
}

body.light-mode .notif-content {
    color: #4b5563 !important;
}

body.light-mode .no-notif {
    color: #9ca3af !important;
}

/* Renkli Duyuru Kutusu (Açık Mod) */
body.light-mode .active-announcement {
    background-color: #f9fafb !important; /* Çok açık gri zemin */
    color: #111111 !important; /* Siyah yazı */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* --- MOBİL UYUMLULUK --- */
@media (max-width: 480px) {
    .header-controls { gap: 5px !important; }
    .notification-wrapper { margin: 0 !important; padding: 0 !important; }
    .notif-btn { padding: 0 5px !important; font-size: 20px !important; }
    #header-role-badge { margin-right: 2px !important; font-size: 18px !important; }
    .header-btn { margin: 0 !important; }

    .notif-dropdown {
        width: 260px !important;
        max-width: 85vw !important;
        right: -45px !important; /* Ekranda ortalamak için */
        max-height: 50vh !important;
        overflow-y: auto !important;
    }
}

/* ========================
   LİDERLİK TABLOSU ROZETLERİ
   ======================== */

.lb-role {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 5px;
    margin-left: 6px;
    color: white;
    font-weight: 800;
    vertical-align: middle;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 0 rgba(0,0,0,0.1);
}

/* Renkler (Settings ile uyumlu) */
.lb-role.admin { background: #eab308; }   /* Sarı */
.lb-role.teacher { background: #3b82f6; } /* Mavi */
.lb-role.pro { background: #a855f7; }     /* Mor */


/* ========================
   OTOMATİK PARLAMA EFEKTİ (SHINE)
   ======================== */

/* 1. Işığın Hareketi (Animasyon) */
@keyframes shine-sweep {
    0% {
        transform: translateX(-150%) skewX(-25deg);
    }
    50%, 100% {
        /* %50'den sonra beklesin ki sürekli göz yormasın */
        transform: translateX(250%) skewX(-25deg);
    }
}

/* 2. Rozetlere Uygulama */
.lb-role {
    position: relative; /* Işık bunun içinde duracak */
    overflow: hidden;   /* Dışarı taşan ışığı gizle */
    z-index: 1;         /* Yazı üstte kalsın */
}

/* Işık Hüzmesi */
.lb-role::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 70%;         /* Işığın genişliği */
    height: 100%;
    
    /* Cam gibi beyaz parıltı (Saydam -> Beyaz -> Saydam) */
    background: linear-gradient(
        to right, 
        rgba(255, 255, 255, 0) 0%, 
        rgba(255, 255, 255, 0.45) 50%, 
        rgba(255, 255, 255, 0) 100%
    );
    
    /* Başlangıç konumu */
    transform: translateX(-150%) skewX(-25deg);
    
    /* Animasyon: 3.5 saniyede bir tekrarla */
    animation: shine-sweep 3.5s infinite ease-in-out;
    pointer-events: none; /* Tıklamayı engellemesin */
}


/* ========================================================
   KESİN ÇÖZÜM: AÇIK UÇLU SORU KUTUSU (KOYU MOD FIX)
   ======================================================== */

/* 1. Varsayılan (Koyu Mod) - ZORLA KOYU YAP */
.open-answer-input {
    background-color: #202f36 !important; /* Koyu zemin (var(--card-bg) karşılığı) */
    color: white !important;              /* Beyaz yazı */
    border: 2px solid #37464f !important;
    border-radius: 16px;
    padding: 16px 18px;
    font-size: 18px;
    font-weight: 700;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: all 0.2s ease;
}

/* 2. Tarayıcı Otomatik Doldurma (Autofill) Yaparsa Beyaz Olmasını Engelle */
/* Chrome/Edge bazen inputları sarı/beyaz yapar, bu kod onu engeller */
.open-answer-input:-webkit-autofill,
.open-answer-input:-webkit-autofill:hover, 
.open-answer-input:-webkit-autofill:focus, 
.open-answer-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #202f36 inset !important; /* İç gölgeyle koyu yap */
    -webkit-text-fill-color: white !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* 3. Light Mode (Beyaz Tema) Ayarları */
/* Burası sadece body sınıfında 'light-mode' varsa çalışır */
body.light-mode .open-answer-input {
    background-color: #ffffff !important; /* Beyaz zemin */
    color: #222222 !important;            /* Siyah yazı */
    border-color: #cccccc !important;
}

body.light-mode .open-answer-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px #ffffff inset !important;
    -webkit-text-fill-color: #222222 !important;
}


