#mobile-panel-dock,
#mobile-left-panel-head,
#btn-minimize-right-panel {
    display: none;
}

#panel-source {
    min-height: 0;
}

.mobile-source-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    color: var(--text-main);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.mobile-source-head button {
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    padding: 6px 10px;
    cursor: pointer;
}

#mobile-source-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px), (pointer: coarse) and (hover: none) {
    #mobile-left-panel-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 42px;
        padding: 8px 14px;
        border-bottom: 1px solid rgba(255,255,255,.08);
        background: rgba(255,255,255,.03);
        color: var(--text-muted);
        font-size: 10px;
        font-weight: 800;
        letter-spacing: .08em;
        text-transform: uppercase;
        flex-shrink: 0;
    }

    #mobile-left-panel-head span {
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

    #mobile-left-panel-head button,
    #btn-minimize-right-panel {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        border: 1px solid rgba(255,255,255,.1);
        border-radius: 8px;
        background: rgba(255,255,255,.06);
        color: var(--text-muted);
        cursor: pointer;
    }

    #mobile-drag-handle #btn-minimize-right-panel {
        position: absolute;
        top: 8px;
        right: 50px;
    }

    .left-col.mobile-panel-minimized,
    .right-col.mobile-panel-minimized {
        display: none !important;
    }

    #mobile-panel-dock {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 12000;
        min-height: 10vh;
        padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
        align-items: stretch;
        justify-content: center;
        gap: 8px;
        background: rgba(2, 6, 23, .96);
        border-top: 1px solid rgba(255,255,255,.12);
        box-shadow: 0 -14px 40px rgba(0,0,0,.35);
    }

    .mobile-panel-tab {
        flex: 1;
        min-width: 0;
        border: 1px solid rgba(255,255,255,.12);
        border-radius: 12px;
        background: rgba(255,255,255,.06);
        color: var(--text-main);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        font-size: 10px;
        font-weight: 800;
        text-transform: uppercase;
        cursor: pointer;
    }

    .mobile-panel-tab i {
        color: var(--primary);
    }

    #mobile-source-content #lista-lists {
        display: flex !important;
        width: 100%;
        padding: 10px 14px !important;
    }

    #mobile-source-content #lista-lists > #livros-scroll {
        min-height: 0;
    }
}

@media (min-width: 769px) and (hover: hover) and (pointer: fine) {
    #btn-source,
    #panel-source {
        display: none !important;
    }
}
@media (max-width: 768px), (pointer: coarse) and (hover: none) {
    /* Controlos compactos, sem ocupar espaço visual desnecessário. */
    #mobile-left-panel-head button,
    #btn-minimize-right-panel,
    #btn-close-bottom-sheet {
        width: 22px !important;
        height: 22px !important;
        min-width: 22px !important;
        min-height: 22px !important;
        border-radius: 6px !important;
        font-size: 10px !important;
    }

    #mobile-drag-handle #btn-minimize-right-panel {
        top: 7px !important;
        right: 40px !important;
    }

    #btn-close-bottom-sheet {
        top: 7px !important;
        right: 10px !important;
    }

    /* A minimização do painel direito é a própria folha a 10vh. */
    .right-col.mobile-panel-minimized {
        display: flex !important;
        bottom: 0 !important;
        height: 10vh !important;
    }

    #mobile-panel-dock {
        min-height: 0 !important;
        height: 40px !important;
        padding: 5px 8px calc(5px + env(safe-area-inset-bottom)) !important;
        justify-content: flex-start !important;
        background: rgba(2, 6, 23, .92) !important;
    }

    .mobile-panel-tab {
        flex: 0 0 32px !important;
        width: 32px !important;
        min-height: 30px !important;
        padding: 0 !important;
        border-radius: 8px !important;
        font-size: 11px !important;
    }

    .mobile-panel-tab span {
        display: none !important;
    }
}
