/* =============================================================
   KATEDRAL MOBILE ADAPTER v1.2 - MEDIA & ARENA STABILIZATION
   Este estilo é ativado em telas menores que 1024px
   Ajustes: Visibilidade de Mídia Social, Alinhamento de Arena e Header
   ============================================================= */

@media (max-width: 1024px) {
    /* 1. RESET ESTRUTURAL PARA MOBILE-SHELL */
    .hub-container {
        flex-direction: column !important;
        border-radius: 0 !important;
        height: 100vh !important;
    }

    /* 2. MENU DRAWER (SIDEBAR DESLIZANTE) */
    .sidebar {
        position: fixed !important;
        left: -100% !important; /* Escondido fora da visão */
        top: 0 !important;
        width: 280px !important;
        height: 100% !important;
        z-index: 10005 !important;
        transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        background: rgba(7, 7, 9, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        border-right: 1px solid var(--neon-blue) !important;
        display: flex !important;
        flex-direction: column !important;
        padding-top: 20px !important;
    }

    .sidebar.drawer-open {
        left: 0 !important; /* Manifestação na tela */
    }

    /* 3. ÁREA DE CONTEÚDO PRINCIPAL (MAIN VIEW) */
    .main-view {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 15px !important;
        padding-top: 85px !important; /* Espaço para o header fixo */
        padding-bottom: 95px !important; /* Espaço para o bottom nav fixo */
        overflow-x: hidden !important;
        display: block !important;
    }

    /* 4. HEADER MOBILE (IDENTIDADE VISUAL) */
    #mobile-app-header {
        display: flex !important;
        position: fixed;
        top: 0; left: 0; width: 100%;
        height: 70px;
        background: rgba(5, 5, 6, 0.95);
        backdrop-filter: blur(15px);
        border-bottom: 1px solid var(--border-color);
        z-index: 10000;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px;
        box-sizing: border-box;
    }

    /* 5. BOTTOM NAVIGATION (ACELERADOR DE ACESSO) */
    #mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0; left: 0; width: 100%;
        height: 75px;
        background: rgba(7, 7, 9, 0.95);
        backdrop-filter: blur(15px);
        border-top: 1px solid var(--border-color);
        z-index: 10000;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom);
        box-sizing: border-box;
    }

    .nav-item-mobile {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: var(--text-muted);
        font-size: 10px;
        font-weight: 800;
        text-decoration: none;
        gap: 4px;
        transition: 0.3s;
    }

    .nav-item-mobile.active {
        color: var(--neon-blue);
        text-shadow: 0 0 12px var(--neon-blue);
    }

    .nav-item-mobile span { 
        font-size: 22px; 
    }

    /* 6. CORREÇÃO CRÍTICA: REDE SOCIAL (VISIBILIDADE DE IMAGENS) */
    .egr-post-card {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        margin-bottom: 25px !important;
        background: rgba(255, 255, 255, 0.03) !important;
        border-radius: 15px !important;
        overflow: hidden !important;
    }

    .egr-post-body {
        padding: 15px !important;
    }

    /* WRAPPER DE SEGURANÇA: Reserva espaço para a imagem não sumir */
    .egr-media-wrapper {
        display: block !important;
        width: 100% !important;
        min-height: 250px !important; /* FORÇA O ESPAÇO DA IMAGEM NO MOBILE */
        background: #000 !important;
        position: relative !important;
    }

    .egr-post-media {
        width: 100% !important;
        height: auto !important;
        min-height: 250px !important;
        max-height: 500px !important;
        object-fit: contain !important;
        display: block !important;
    }

    .egr-feed-container {
        padding: 0 !important;
        height: auto !important;
        display: block !important;
    }

    /* 7. CORREÇÃO CRÍTICA: ARENA (MAPA DO TESOURO 8x8) */
    .th-grid-container {
        padding: 10px !important;
        margin-bottom: 20px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .th-grid {
        display: grid !important;
        grid-template-columns: repeat(8, 1fr) !important; /* Mantém as 8 colunas táticas */
        gap: 5px !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .th-cell {
        aspect-ratio: 1 / 1 !important; /* Garante quadrados perfeitos */
        font-size: 9px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    /* 8. AJUSTES DO CHAT NO MOBILE (FIX DE SOBREPOSIÇÃO) */
    .egr-main-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        height: auto !important;
    }

    .egr-chat-sidebar {
        height: 450px !important;
        margin-bottom: 50px !important;
    }

    /* 9. REFINO DE CARROSSEL NO MOBILE */
    .egr-ad-slot {
        padding: 0 15px !important;
        height: 180px !important;
    }

    .egr-ad-content {
        max-width: 180px !important;
    }

    .egr-ad-content h2 {
        font-size: 16px !important;
    }

    .egr-server-profile-zone {
        width: 90px !important;
        height: 90px !important;
    }

    .egr-server-gif {
        width: 80px !important;
        height: 80px !important;
    }

    /* Esconder scrollbar para estética de App Nativo */
    .main-view::-webkit-scrollbar {
        display: none;
    }
}

/* Ocultar elementos exclusivos do App no Desktop */
#mobile-app-header, #mobile-bottom-nav { 
    display: none; 
}