/* --- MOBILE & TABLET OPTIMIZATION --- */

/* Dokunmatik Ekran Genel Optimizasyonları */
* {
    -webkit-tap-highlight-color: transparent; /* Mobil cihazlarda tıklamadaki mavi kutuyu kaldırır */
}

button, .click-zoom-trigger, .menu-item, .nav-item {
    touch-action: manipulation; /* Çift tıklama gecikmelerini önler, anında tepki verir */
}

/* Iyzico Footer Logo Ortak Stiller */
.iyzico-footer-logo {
    position: fixed; bottom: 25px; right: 30px; z-index: 999999;
    opacity: 0.85; filter: grayscale(100%) brightness(150%); transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.27);
    display: block;
}
.iyzico-footer-logo img { height: 40px; display: block; } /* Boyut büyütüldü */
.iyzico-footer-logo:hover {
    opacity: 1; filter: grayscale(0%) brightness(100%); transform: scale(1.1) translateY(-3px);
}

/* Tablet (Max 1024px) */
@media (max-width: 1024px) {
    .menu-container { width: 280px; padding: 20px; }
    .panel-container { width: 95%; }
}

/* Mobile (Max 768px) */
@media (max-width: 768px) {
    html, body { max-width: 100%; overflow-x: hidden; }
    body { flex-direction: column; overflow-y: auto; overflow-x: hidden; width: 100%; position: relative; }
    
    /* Gizlenebilen (Slide-in) Yan Menü */
    .mobile-menu-btn { display: flex !important; }
    .menu-container { 
        position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; 
        flex-direction: column; justify-content: flex-start; padding: 50px 30px; align-items: center;
        background: rgba(10,10,14,0.75); border-right: 2px solid #342c78; z-index: 99999;
        backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
        transform: translateX(-100%); transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
        overflow-y: auto;
        box-sizing: border-box;
        scrollbar-width: none; /* Firefox için kaydırma çubuğunu gizle */
        -ms-overflow-style: none; /* IE ve Edge için gizle */
    }
    .menu-container::-webkit-scrollbar { display: none; } /* Chrome ve Safari için gizle */
    body.mobile-menu-open .menu-container { transform: translateX(0); }
    
    .menu-list { flex-direction: column; gap: 15px; padding: 0; width: 100%; text-align: center; }
    .menu-item { font-size: 1rem; border-left: none; border-bottom: 2px solid transparent; padding: 10px 15px; letter-spacing: 3px; min-height: 44px; }
    .menu-item.active { border-left: none; border-bottom: 2px solid #f8d33c; transform: translateY(-3px); }
    .menu-header { display: flex; justify-content: center; width: 100%; margin-bottom: 30px; margin-top: 10px; padding: 0;}
    .menu-header .brand-logo-wrapper { max-width: 160px; margin: 0 auto; }
    
    /* Panellerin Mobilde Ekranı Kaplaması */
    .panel-container { 
        top: 50%; left: 50% !important; transform: translate(-50%, -50%); 
        width: 95% !important; max-width: none; max-height: 90vh; padding: 20px 15px; 
        z-index: 80; border-radius: 0; border-width: 1px;
    }
    
    /* Ayarlar Menüsü Mobil Temizliği */
    .settings-layout { gap: 15px; }
    .setting-row { flex-direction: column; align-items: flex-start; gap: 15px; padding: 15px; }
    .setting-info { max-width: 100%; }
    .toggle-switch { align-self: flex-end; }
    
    .mc-actions { grid-template-columns: 1fr !important; gap: 6px; }
    .btn, .mc-btn, .size-btn { min-height: 44px; display: flex; align-items: center; justify-content: center; }

    /* Arka plandaki sporcunun mobilde panellerin üstüne çıkmaması için */
    #dynamic-athlete { 
        left: 50% !important; 
        top: auto !important; 
        bottom: 0 !important; 
        height: 70vh !important; /* Çok uzun olup genişliği taşırmaması için hafif kısaltıldı */
        width: auto !important;
        max-width: 160% !important;
        opacity: 0.9 !important; /* Görsel artık daha aktif ve belirgin */
        pointer-events: none;
        z-index: 1 !important; /* Panellerin arkasında kalmasını garantiler */
    }
    
    /* Shop & Carousel Adjustments */
    .ps1-carousel-container { height: 360px; perspective: 800px; margin-top: 10px; }
    .ps1-item { width: 160px; height: 240px; }
    .ps1-item.active { transform: translateX(0) translateZ(40px) scale(1.15); }
    .ps1-item.prev { transform: translateX(-100px) translateZ(-80px) scale(0.85); }
    .ps1-item.next { transform: translateX(100px) translateZ(-80px) scale(0.85); }
    .ps1-arrow { font-size: 2rem; padding: 10px; opacity: 0.8; }
    .ps1-arrow:first-child { left: -10px; }
    .ps1-arrow:last-child { right: -10px; }
    
    /* Ürün Detay - Dikey Düzen */
    .exhibition-panel { overflow-y: auto !important; padding-bottom: 60px !important; }
    .exhibition-layout { height: auto !important; min-height: 100%; padding: 70px 20px 30px 20px !important; }
    .exhibition-container-split { grid-template-columns: 1fr; gap: 30px; max-height: none; overflow-y: visible; }
    .floating-img-box { max-width: 220px; }
    .pd-title { font-size: 1.6rem; }
    .exhibition-text-block { padding: 20px; }
    
    /* Sözlük Adjustments (Mobile Ekşi Layout) */
    .forum-user-profile-bar { position: relative; top: auto; right: auto; justify-content: center; margin-bottom: 20px; flex-wrap: wrap; } /* Sağ üst profil barı */
    
    .forum-layout { flex-direction: column; height: auto; margin-top: 10px; }
    .forum-sidebar { width: 100%; border-right: none; padding-right: 0; max-height: 50vh; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 15px; margin-bottom: 15px;}
    .forum-main { display: none; padding-right: 0;}
    
    /* Mobilde konu açıldığında sol listeyi gizle */
    .forum-layout.show-topic .forum-sidebar { display: none; }
    .forum-layout.show-topic .forum-main { display: flex; width: 100%; }
    .mobile-forum-back { background: transparent; border: none; color: #888; padding: 0; margin-bottom: 15px; font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600; cursor: pointer; align-self: flex-start; letter-spacing: 1px; display: inline-block; text-transform: uppercase;}
    .mobile-forum-back:hover { color: #ffd217; }
    
    /* Forum Mesaj Alanı ve Hiyerarşisi (Sola Dayalı Olanı Üste Alma) */
    .forum-title { font-size: 16px; margin-bottom: 15px; padding: 0 0 10px 0; }
    .forum-post { flex-direction: column; gap: 8px; padding: 12px 0; margin-bottom: 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
    .forum-post-left { width: 100%; display: grid; grid-template-columns: 32px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding-bottom: 0; }
    .forum-post-avatar { grid-row: 1 / 3; grid-column: 1; width: 32px; height: 32px; margin-bottom: 0; box-shadow: none; border: 1px solid #444; }
    .forum-post-author { grid-row: 1; grid-column: 2; font-size: 13px; margin-top: 0; align-self: end; }
    .forum-post-role { grid-row: 2; grid-column: 2; font-size: 11px; margin-top: 0; margin-left: 0; text-align: left; align-self: start; } 
    .forum-post-right { width: 100%; }
    
    /* Speech Bubble Tail Mobile Adjustment (Remove) */
    .forum-post-right::before, .forum-post-right::after { display: none; }
    .forum-textarea { font-size: 16px; /* iOS zoom fix */ }

    /* Sticky Reply Box for Mobile */
    .forum-reply-wrapper { position: sticky; bottom: 0; background: rgba(10, 10, 14, 0.95); backdrop-filter: blur(10px); z-index: 10; padding: 15px 0 10px 0; border-top: 1px solid rgba(255,255,255,0.05); margin-top: 10px; }
    body.light-mode .forum-reply-wrapper { background: rgba(255, 255, 255, 0.95); border-top-color: rgba(52, 44, 120, 0.1); }
    body.plus90-mode .forum-reply-wrapper { background: rgba(10, 10, 10, 0.95); border-top-color: rgba(255, 255, 255, 0.1); }
    
    .thread-info h4 { font-size: 14px; }
    .thread-stats { font-size: 13px; }
    
    /* Yeni AAA Modalı Mobile Uyarlama */
    .aaa-modal-box { flex-direction: column; }
    .auth-left { display: none; }
    .auth-right { padding: 25px 15px; }
    .auth-box input, .auth-box button { padding: 16px; font-size: 1.1rem; } /* Forma parmakla kolay tıklama */
    .auth-box h3 { font-size: 1.3rem; }
    
    /* Modal Kutu Esnek Boyutlandırma & Taşma Koruması */
    .auth-box {
        width: 90% !important;
        padding: 25px 20px !important;
        max-height: 90vh !important;
    }
    .modal-input { min-height: 44px; }

    /* Misc Components */
    .footer-bar { display: none; } /* Mobilde alt kayan yazıyı kaldırıyoruz */
    .ea-music-widget { top: 15px; width: 270px; border-radius: 0; border: 1px solid #342c78; }
    .floating-close-btn { top: 15px; right: 15px; font-size: 0.75rem;}
    
    /* Tema Butonları Mobilde Kapsül Olarak Alta Oturur */
    .theme-selector-fixed { bottom: 15px; width: auto; left: 50%; transform: translateX(-50%); border-radius: 30px; padding: 4px; justify-content: center; }
    body.plus90-mode .theme-selector-fixed { width: 100%; left: 0; transform: none; bottom: 0; border-radius: 0; padding: 0; }
    .theme-btn { flex: auto; text-align: center; }
    .floating-cart-btn { bottom: 50px; } /* Butonların altında kalmaması için yükseltiriz */

    /* --- Ekstra Mobil İyileştirmeler --- */
    .panel-title { font-size: clamp(1.4rem, 6vw, 2rem); text-align: center; line-height: 1.2; }
    .panel-subtitle { text-align: center; font-size: 0.8rem; }
    .panel-header { display: flex; flex-direction: column; align-items: center; }
    
    /* New Arrivals Mobil Düzenlemesi */
    .na-hero-aaa { flex-direction: column; padding: 32px 24px; gap: 24px; justify-content: center; text-align: center; }
    .na-hero-content { align-items: center; text-align: center; width: 100%; padding-bottom: 16px; }
    .na-badge { align-self: center; }
    .na-hero-content h2 { font-size: clamp(1.4rem, 6vw, 1.8rem); margin-bottom: 12px; }
    .na-hero-content p { max-width: 100%; font-size: 0.9rem; margin-bottom: 24px; }
    .na-cta-btn { align-self: center; width: 100%; text-align: center; }
    
    .na-hero-visuals { grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; }
    .na-visual-item { aspect-ratio: 4/5; }
    .na-visual-item img { height: 100%; object-fit: cover; }
    
    /* Packs (Kutu Açılımı) Mobil Düzenlemesi */
    .mystery-pack-showcase { flex-direction: column; padding: 25px 15px; gap: 20px; text-align: center; }
    .mp-right { align-items: center; width: 100%; }
    .mp-title { font-size: 1.2rem; }
    .mp-stats { border-left: none; border-bottom: 2px solid #ffd217; padding-left: 0; padding-bottom: 15px; width: 100%; margin-bottom: 15px; }
    .mp-actions { flex-direction: row; width: 100%; gap: 10px; flex-wrap: wrap; justify-content: center; }
    .mp-actions button { flex: 1; min-width: 120px; font-size: 0.9rem; padding: 12px; }
    
    /* R6 Reveal (Paket Açılış) Mobil Düzenlemesi */
    .r6-reveal-container { flex-direction: column; gap: 20px; width: 95%; max-height: 90vh; overflow-y: auto; padding: 20px 10px; }
    .r6-left-card { justify-content: center; }
    .r6-left-card .roulette-card { width: 200px; height: 285px; transform: none !important; } /* Ağır 3D eğimini mobilde sıfırlar */
    .r6-right-info { align-items: center; text-align: center; border-left: none; border-top: 2px solid #ffd217; padding: 20px 10px; background: rgba(0,0,0,0.8); border-radius: 0; }
    .r6-card-name { font-size: 1.6rem; }
    
    /* Mobil Iyzico Footer Fix (En alt merkeze hizalama) */
    .iyzico-footer-logo {
        bottom: 15px; left: 15px; right: auto; transform: none;
        opacity: 0.8; filter: grayscale(100%) brightness(150%);
    }
    
    /* Ürün İnceleme (Shop) Mobil Düzenlemesi */
    .pd-title { font-size: 1.4rem; text-align: center; }
    .pd-price { text-align: center; }
    .exhibition-left { gap: 15px; }
    .sharp-stat-label { width: 100px; font-size: 0.65rem; }
    
    /* Sosyal Medya & Lookbook Mobil Düzenlemesi */
    .social-links-row { flex-direction: column; gap: 10px; }
    .ig-header { flex-direction: column; text-align: center; gap: 15px; }
    .ig-header-left { flex-direction: column; }
    .photobook-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding-right: 0; }
    
    /* Çıkartma Albümü ve Tooltip Düzeni */
    .sticker-album-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 15px; padding: 15px 5px; }
    .kit-nav { flex-wrap: wrap; gap: 10px; }

    /* Kart Havuzu Göstergesi Fix */
    .pack-pool-tooltip { left: 50%; top: auto; bottom: 100%; transform: translate(-50%, -10px); width: 200px; }
    .mp-left:hover .pack-pool-tooltip { transform: translate(-50%, -20px); }

    /* Paneller Açıkken Arka Plan Okunabilirliğini Artırmak İçin Sporcu Opaklığını Düşür */
    body.panel-open #dynamic-athlete { opacity: 0.15 !important; }
    .auth-modal { padding: 20px; align-items: flex-start; overflow-y: auto; }
    .floating-close-btn { top: 10px; right: 10px; padding: 5px 10px; font-size: 0.8rem; }

    /* --- OYUN (EMÜLATÖR) ALANI TAM EKRAN (FULLSCREEN) ÇÖZÜMÜ --- */
    body[data-active-panel="television"] .panel-container {
        width: 100vw !important; height: 100vh !important; max-height: 100vh !important; top: 0 !important; left: 0 !important; transform: none !important; padding: 0 !important; border: none !important; border-radius: 0 !important; z-index: 999999 !important; background: #000 !important; display: flex; flex-direction: column; justify-content: flex-start;
    }
    /* Sol bilgi paneli ve başlığı gizle, sadece oyunu bırak */
    body[data-active-panel="television"] .tv-info-column,
    body[data-active-panel="television"] .forum-title { display: none !important; }
    body[data-active-panel="television"] .tv-layout { padding: 0 !important; margin: 0 !important; gap: 0 !important; }
    body[data-active-panel="television"] .tv-game-column { padding: 0 !important; justify-content: flex-start !important; }
    /* Dokunmatik Gamepad için alt tarafta 40-50vh boşluk bırak (EmulatorJS oraya yerleşir) */
    body[data-active-panel="television"] #tv-screen-wrapper { width: 100% !important; max-height: 50vh !important; border: none !important; box-shadow: none !important; margin: 0 !important; aspect-ratio: auto; }
    body[data-active-panel="television"] .tv-game-column > div:last-child { padding: 10px; justify-content: center; } /* Butonları ortala */
}

/* --- MOBİL YATAY (LANDSCAPE) OYUN OPTİMİZASYONU --- */
@media (max-height: 600px) and (orientation: landscape) {
    body[data-active-panel="television"] .panel-container {
        width: 100% !important; height: 100vh !important; max-height: 100vh !important;
        top: 0 !important; left: 0 !important; transform: none !important;
        padding: 10px !important; z-index: 999999 !important;
        display: flex; flex-direction: column; justify-content: center;
    }
    body[data-active-panel="television"] .tv-info-column,
    body[data-active-panel="television"] .forum-title { display: none !important; }
    body[data-active-panel="television"] .tv-layout { padding: 5px !important; margin: 0 !important; gap: 0 !important; }
    body[data-active-panel="television"] .tv-game-column { padding: 0 !important; justify-content: center !important; }
    body[data-active-panel="television"] #tv-screen-wrapper { width: 100% !important; max-height: 85vh !important; border: none !important; box-shadow: none !important; margin: 0 auto !important; aspect-ratio: 4/3; }
    body[data-active-panel="television"] .tv-game-column > div:last-child { display: none !important; } /* Tam ekran modunda alt butonları gizle */
}