/* RO_SPORT — adaptación móvil compartida */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

main {
    min-width: 0;
    width: 100%;
}

.ro-mobile-nav {
    display: none;
}

@media (max-width: 767px) {
    body {
        display: block !important;
        height: 100dvh !important;
        min-height: 100dvh;
        padding-bottom: 68px;
        overflow-y: auto !important;
    }

    .sidebar,
    body > aside {
        display: none !important;
    }

    main {
        height: auto !important;
        min-height: calc(100dvh - 68px);
        overflow-x: hidden !important;
        overflow-y: visible !important;
        padding: 16px !important;
        padding-bottom: 88px !important;
    }

    main > div:first-child,
    main > header,
    .mobile-stack-header {
        gap: 12px;
        align-items: flex-start !important;
        flex-wrap: wrap !important;
    }

    .p-8 {
        padding: 1rem !important;
    }

    .p-12 {
        padding: 1.25rem !important;
    }

    .text-2xl,
    .text-3xl {
        font-size: 1.25rem !important;
        line-height: 1.55rem !important;
    }

    .text-xl {
        font-size: 1.1rem !important;
        line-height: 1.4rem !important;
    }

    .card-custom,
    .match-card,
    #matches-grid > * {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    #matches-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 14px !important;
    }

    #league-filters {
        width: calc(100vw - 32px);
        max-width: calc(100vw - 32px);
        overflow-x: auto !important;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
    }

    #league-filters > * {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    #agent-main {
        box-sizing: border-box;
        height: calc(100dvh - 64px - env(safe-area-inset-bottom)) !important;
        min-height: 0 !important;
        padding: 10px 12px 8px !important;
        overflow: hidden !important;
    }

    #agent-main .agent-header {
        flex: 0 0 auto;
        padding: 4px 2px 10px !important;
        gap: 8px;
        align-items: center !important;
        flex-wrap: nowrap !important;
    }

    #agent-main .agent-header img { width: 34px !important; height: 34px !important; }
    #agent-main .agent-header p { font-size: 10px !important; line-height: 1.25 !important; }

    #agent-main .chat-container {
        flex: 1 1 auto;
        height: auto !important;
        min-height: 0 !important;
        margin: 8px 0 !important;
        padding: 2px 1px 18px 0 !important;
        overflow-y: auto !important;
        overscroll-behavior: contain;
        scrollbar-width: thin;
    }

    #agent-main .chat-container > div { gap: 7px !important; }
    #agent-main .chat-container img { width: 27px !important; height: 27px !important; }
    #agent-main .bubble-ro,
    #agent-main .bubble-user {
        max-width: calc(100vw - 55px) !important;
        padding: 12px !important;
        border-radius: 16px !important;
        font-size: 13px !important;
        line-height: 1.48 !important;
        overflow-wrap: anywhere;
    }

    #agent-main .agent-composer {
        flex: 0 0 auto;
        z-index: 10;
        padding: 6px 0 2px;
        background: #0b0e14;
    }

    #agent-main .agent-composer .input-bar { min-width: 0; padding: 7px 10px !important; }
    #agent-main .agent-composer input { min-width: 0; font-size: 14px !important; }
    #agent-main #send-btn { width: 46px !important; height: 46px !important; }

    .bubble-ro,
    .bubble-user {
        max-width: calc(100vw - 72px) !important;
        overflow-wrap: anywhere;
    }

    .ro-mobile-nav {
        position: fixed;
        z-index: 9999;
        left: 0;
        right: 0;
        bottom: 0;
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        align-items: center;
        min-height: 64px;
        padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
        background: rgba(13, 17, 26, 0.98);
        border-top: 1px solid #263244;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
        backdrop-filter: blur(14px);
    }

    .ro-mobile-nav a {
        min-width: 0;
        color: #94a3b8;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 4px 1px;
        font-size: 9px;
        line-height: 1;
        text-decoration: none;
        white-space: nowrap;
    }

    .ro-mobile-nav a:active,
    .ro-mobile-nav a:hover,
    .ro-mobile-nav a[aria-current="page"] {
        color: #facc15;
    }

    .ro-mobile-nav i {
        font-size: 16px;
    }
}

@media (max-width: 380px) {
    .ro-mobile-nav a {
        font-size: 8px;
    }

    main {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}
