/* --- 1. Temel Sıfırlama --- */
* { box-sizing: border-box; outline: none; }
body, html { margin: 0; padding: 0; height: 100%; background: #000; overflow: hidden; font-family: 'Segoe UI', sans-serif; }

#game-container {
    width: 100%; 
    height: 100dvh; /* DİNAMİK VİEWPORT: Tarayıcı barlarını otomatik hesaplar ve sığdırır */
    max-width: 500px; margin: 0 auto;
    position: relative; background-color: #000; overflow: hidden;
}

.view { 
    width: 100%; height: 100%; position: absolute; 
    top: 0; left: 0; display: flex; flex-direction: column; 
    align-items: center; z-index: 5; 
    /* 💥 İŞTE BOŞLUK YARATAN VE EKRANI SIKIŞTIRAN SATIR! */
    padding-bottom: calc(85px + env(safe-area-inset-bottom)); 
}
.hidden { display: none !important; }

/* --- 2. Giriş Ekranı --- */
#view-home { 
    background: url('/static/img/ui/home_bg.webp') no-repeat center center; 
    background-size: cover; 
    justify-content: flex-start; /* Üstten başlar */
    padding: 60px 20px 0 20px; 
}
/* Görselin üstüne hafif bir karartma atıyoruz ki yazılar okunsun */
#view-home::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4); z-index: -1;
}

.home-top { text-align: center; width: 100%; z-index: 10; margin-bottom: 20px; }
.game-logo { font-size: 48px; color: #fff; line-height: 0.8; margin-bottom: 50px; text-transform: uppercase; font-weight: 900; text-shadow: 0 0 20px rgba(0,0,0,0.8); }
.game-logo span { color: #ffd700; font-size: 26px; letter-spacing: 6px; display: block; margin-top: 10px; }
.main-btn { width: 260px; height: 65px; background: #ffd700; color: #000; border: none; border-radius: 40px; font-size: 20px; font-weight: 900; cursor: pointer; box-shadow: 0 10px 25px rgba(255, 215, 0, 0.4); transition: 0.3s; }
.main-btn:active { transform: scale(0.95); }

/* Yeni Eklenen AI ve Yasal İkon Bölümü */
.home-center { text-align: center; width: 100%; z-index: 10; padding: 20px; margin-top: 0; margin-bottom: 15px; }
.legal-badges { display: flex; justify-content: center; gap: 10px; margin-bottom: 15px; }
.badge { 
    background: rgba(0,0,0,0.8); border: 1px solid #ffd700; color: #ffd700; 
    padding: 8px 15px; border-radius: 10px; font-size: 12px; font-weight: bold; 
    cursor: pointer; transition: 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    text-transform: uppercase;
}
.badge:active { transform: scale(0.9); background: #ffd700; color: #000; }

.ai-disclaimer { 
    color: #888; /* Modal içinde daha iyi okunur */
    font-size: 11px; line-height: 1.4; 
    text-align: center; margin-bottom: 10px; 
}

/* Yeşil Renkli Şartlar Metni Eklenmiştir */
.terms-disclaimer { 
    color: #2ecc71; font-size: 10px; 
    font-weight: bold; line-height: 1.3; 
    text-align: center; margin: 0 auto; 
}

.home-bottom { 
    position: absolute; 
    bottom: calc(10px + env(safe-area-inset-bottom)); /* Tam senin istediğin 10px boşluk */
    left: 0; width: 100%; 
    text-align: center; padding: 0 15px; 
    z-index: 10; 
    display: flex; flex-direction: column; gap: 10px; /* Elemanlar arası 10px boşluk */
}
.warning-box { 
    background: rgba(0, 0, 0, 0.6); 
    border: 1px solid rgba(255, 0, 0, 0.3); 
    padding: 15px; 
    border-radius: 12px; 
    margin-bottom: 15px; /* Burayı 20'den 5'e düşürdük ki yazı kutuya yakın olsun */
    backdrop-filter: blur(5px); 
}
.warning-box p { color: #bbb; font-size: 11px; margin: 0; line-height: 1.5; }
.policy-link { 
    color: #666; 
    font-size: 11px; 
    text-decoration: underline; 
    cursor: pointer; 
    display: block; 
    margin-bottom: 15px; /* Bu değeri artırdıkça yazı yukarı çıkar, 15px veya 20px idealdir */
}

/* --- 3. Karakterler & Bölümler --- */
#view-characters { background: #000; padding: 15px; position: relative; }
.screen-header { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding: 10px 5px; }
.screen-title { color: #fff; font-size: 24px; font-weight: 800; margin: 0; }

/* MADDE 2: BANNER REKLAM SABİTLEME VE SCROLL DÜZELTME (YENİ HALİ) */
#character-grid { 
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; 
    width: 100%; overflow-y: auto; 
    padding-bottom: calc(120px + env(safe-area-inset-bottom)) !important; /* Reklam için pay artırıldı */
}

.char-card { display: flex; flex-direction: column; align-items: center; margin-bottom: 10px; cursor: pointer; }
.char-thumb { width: 100%; aspect-ratio: 1 / 1; border-radius: 12px; border: 2px solid #222; object-fit: cover; background: #111; }
.char-name { color: #fff; font-size: 13px; font-weight: bold; margin-top: 8px; display: block; }
.char-card.premium-slot .char-thumb { border: 2px solid #ffd700; box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }

#view-scenarios { background: #080808; padding: 20px; overflow: hidden; display: flex; flex-direction: column; }
#scenario-list { 
    width: 100%; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    overflow-y: auto; /* Kaydırmayı açtık */
    flex: 1; /* Kalan tüm boşluğu kaplar */
    padding-bottom: 110px; /* Pay bırakıldı */
    -webkit-overflow-scrolling: touch; 
}
.scenario-item { background: #1a1a1a; border: 1px solid #333; border-radius: 15px; padding: 20px; color: #fff; display: flex; align-items: center; cursor: pointer; }
.scenario-title { font-weight: bold; font-size: 17px; color: #fff; display: block; }
.scenario-desc { color: #777; font-size: 12px; }

/* --- 4. Gameplay & Resim Ölçekleme --- */
#bg-layer { 
    width: 100%; height: 100%; position: absolute; top: 0; left: 0; 
    background-size: cover; 
    background-position: center; 
    background-repeat: no-repeat; 
    background-color: #000; 
    z-index: 1; 
}
#top-bar { position: absolute; top: max(15px, env(safe-area-inset-top)); left: 0; width: 100%; height: 50px; padding: 0 15px; z-index: 100; display: flex; justify-content: space-between; align-items: center; }
.top-right-group { display: flex; gap: 8px; pointer-events: auto; }

/* SKOR RENGİ BEYAZA ZORLANDI */
#energy-count, #total-score, #scenario-total-score { color: #ffffff !important; font-weight: bold; }

#status-panel { background: rgba(0, 0, 0, 0.7); border: 1px solid rgba(255, 255, 255, 0.1); padding: 5px 12px; border-radius: 20px; display: flex; align-items: center; gap: 6px; }
#heart-icon { width: 20px !important; height: 20px !important; object-fit: contain; }

/* REKLAM DÜZENLEMESİ: Gameplay butonlarının reklamın altında kalmaması için padding artırıldı */
#bottom-ui { position: absolute; bottom: 0; left: 0; width: 100%; padding: 20px 15px calc(65px + env(safe-area-inset-bottom)); z-index: 10; background: linear-gradient(transparent, rgba(0,0,0,0.95) 40%); }
#dialog-box { width: 100%; min-height: 100px; background: rgba(0, 0, 0, 0.8); border: 1px solid rgba(255,255,255,0.1); border-radius: 15px; padding: 15px 20px; color: #fff; font-size: 16px; line-height: 1.4; display: flex; align-items: center; justify-content: center; text-align: center; margin-bottom: 15px; }

/* MOBİL BUTON TASARIMI */
.btn { 
    width: 100%; 
    min-height: 50px; 
    border: none; 
    background: #ffffff; 
    color: #000000; 
    font-weight: bold; 
    border-radius: 30px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    cursor: pointer; 
    margin-bottom: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-premium { background: #ffd700; color: #000; border: 2px solid #fff; }

/* --- 5. Spin & Footer --- */
#spin-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); z-index: 11000; display: flex; justify-content: center; align-items: center; }
.spin-glass-content { width: 85%; max-width: 360px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 35px; padding: 30px; text-align: center; color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.wheel-box { width: 220px; height: 220px; margin: 30px auto; position: relative; }
.wheel { width: 100%; height: 100%; border-radius: 50%; border: 6px solid #ffd700; background: conic-gradient(#222 0deg 45deg, #333 45deg 90deg, #222 90deg 135deg, #333 135deg 180deg, #222 180deg 225deg, #333 225deg 270deg, #222 270deg 315deg, #333 315deg 360deg); transition: transform 4s cubic-bezier(0.15, 0, 0.15, 1); }
#footer-bar { 
    position: absolute; bottom: 0; left: 0; width: 100%; 
    /* 💥 BUTONLARIN ARASINI AÇAN SABİT DEĞER! */
    height: calc(75px + env(safe-area-inset-bottom)); 
    background: rgba(10, 10, 10, 0.98); border-top: 1px solid #222; 
    display: flex; justify-content: space-around; align-items: flex-start; 
    padding-top: 12px; z-index: 1000; 
}
.footer-item { display: flex; flex-direction: column; align-items: center; color: #888; cursor: pointer; transition: 0.3s; }
.footer-item span { font-size: 10px; font-weight: bold; text-transform: uppercase; margin-top: 4px; }
.footer-item:active { color: #ffd700; transform: scale(0.9); }

/* --- 6. REKLAM PANELİ (AD-OVERLAY) --- */
#ad-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 12000; 
    display: flex;
    justify-content: center;
    align-items: center;
}
#ad-overlay.hidden { display: none !important; }
.ad-content {
    width: 85%; max-width: 350px;
    background: #222; border: 1px solid #ffd700;
    border-radius: 20px; padding: 25px;
    text-align: center; color: white;
}
.ad-placeholder {
    width: 100%; height: 150px; background: #333;
    border-radius: 10px; margin-bottom: 20px;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.ad-buttons { display: flex; flex-direction: column; gap: 10px; }
.watch-btn {
    width: 100%; height: 50px; background: #ffd700;
    color: black; border: none; border-radius: 25px;
    font-weight: bold; cursor: pointer;
}
.close-btn {
    background: none; border: none; color: #888;
    text-decoration: underline; cursor: pointer; padding: 10px;
}
.loader {
    border: 4px solid #444; border-top: 4px solid #ffd700;
    border-radius: 50%; width: 30px; height: 30px;
    animation: spin 1s linear infinite; margin-top: 10px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* KİLİTLİ KARAKTER GÖRÜNÜMÜ */
.char-card.locked {
    position: relative;
}
.char-card.locked .char-thumb {
    filter: grayscale(1) opacity(0.5); 
}
.char-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    z-index: 10;
}

/* MODAL / POP-UP TASARIMI */
.overlay-box {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9); z-index: 13000;
    display: flex; justify-content: center; align-items: center;
}
.modal-content {
    width: 85%; max-width: 350px; background: #222; border: 2px solid #ffd700;
    border-radius: 25px; padding: 25px; text-align: center; color: #fff;
    position: relative; /* Kapatma butonu için */
}
.modal-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

#unlock-confirm-btn:disabled {
    background: #444; color: #888; cursor: not-allowed; box-shadow: none;
}

/* INFO MODAL ÖZEL STILLERI */
#info-body { color: #ccc; font-size: 13px; line-height: 1.6; margin-top: 15px; text-align: left; background: #111; padding: 15px; border-radius: 12px; }
.close-info { position: absolute; top: 15px; right: 15px; background: none; border: none; color: #ffd700; font-size: 22px; cursor: pointer; z-index: 100; }

/* --- PREMIUM SISTEM GÖRSEL VE KATMAN DÜZELTMELERİ --- */
#ad-overlay { z-index: 99999 !important; } 
#premium-modal { z-index: 99998 !important; }
.overlay-box { z-index: 99990; }

.premium-progress-container { display: flex; justify-content: center; gap: 8px; margin: 20px 0; }
.progress-step { width: 40px; height: 10px; background: #444; border-radius: 5px; transition: 0.3s; }
.progress-step.active { background: #ffd700; box-shadow: 0 0 10px #ffd700; }
#gift-box-container { font-size: 50px; margin-bottom: 10px; transition: 0.5s; text-align: center; }
.gift-open { transform: scale(1.3); filter: drop-shadow(0 0 15px #ffd700); }

/* --- 7. EKLEMELER: TEASER & GENEL DÜZENLEME --- */
.scenario-item.premium { border: 1px solid rgba(255, 215, 0, 0.4); background: linear-gradient(90deg, #1a1a1a, #2a2300); }
.scenario-item.teaser-item { border: 2px solid #ffd700; animation: goldPulse 2s infinite; }
@keyframes goldPulse { 0% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.3); } 50% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); } 100% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.3); } }

/* --- 8. INTRO MODAL (DİL & YAŞ) ÖZEL STILLERI --- */
#intro-modal { z-index: 100000 !important; } /* Her şeyin üstünde olmalı */
.intro-section { margin-bottom: 25px; text-align: center; }
.intro-label { color: #888; font-size: 11px; margin-bottom: 10px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }
.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lang-btn { 
    background: #111; border: 1px solid #333; color: #fff; padding: 12px; border-radius: 12px; 
    font-size: 14px; font-weight: bold; cursor: pointer; transition: 0.3s;
}
.lang-btn.active { border-color: #ffd700; color: #ffd700; background: rgba(255, 215, 0, 0.05); }
.dob-row { display: flex; gap: 8px; justify-content: center; }
.dob-select { 
    background: #111; border: 1px solid #333; color: #fff; padding: 10px; border-radius: 10px; 
    font-size: 14px; flex: 1; text-align: center; appearance: none;
}
.dob-select:focus { border-color: #ffd700; outline: none; }

/* REKLAM ALANI İÇİN GÖRÜNMEZ YER TUTUCU */
#ad-banner-placeholder { height: 55px; width: 100%; background: transparent; }